package com.zr.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletResponseAware;
import org.springframework.stereotype.Controller;

import com.zr.model.Corder;
import com.zr.service.InsertEIRService;
	/**
	 * lxg
	 * @author Administrator
	 *
	 */
@Controller
public class InsertEIRAction implements ServletResponseAware{
	private HttpServletResponse resp;
	private int seid;
	private int oid;
	private int crid;
	private int did;
	
	
	public int getSeid() {
		return seid;
	}

	public void setSeid(int seid) {
		this.seid = seid;
	}

	public int getOid() {
		return oid;
	}

	public void setOid(int oid) {
		this.oid = oid;
	}

	public int getCrid() {
		return crid;
	}

	public void setCrid(int crid) {
		this.crid = crid;
	}

	public int getDid() {
		return did;
	}

	public void setDid(int did) {
		this.did = did;
	}

	@Override
	public void setServletResponse(HttpServletResponse arg0) {
		this.resp=arg0;
	}
	@Resource
	private InsertEIRService inEIRseim;
	
	public void insertEIR(){
		resp.setCharacterEncoding("utf8");
		try {
			PrintWriter pw=resp.getWriter();
			System.out.println(1);
			Corder co=inEIRseim.getCorderByOid(oid);
			System.out.println(2);
			String restartp=co.getStartp();
			String reendp=co.getEndp();
			System.out.println(3);
			inEIRseim.getEir(seid, oid, restartp, reendp, crid, did);
			System.out.println(4);
			pw.write("1");
			pw.flush();
			pw.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
